#include <stdio.h>
#include <iostream>
using namespace std;

int SecondMinSingleLoop(const int arr[], const int length)
{
	if(!arr || !length || length < 2)
		return 0;
	int min = arr[0], minner = arr[1];
	if(min < minner)
	{
		int temp = min;
		min = minner;
		minner = temp;
	}
	for(int i = 0; i < length; i++)
	{
		if(arr[i] < minner)
		{
			min = minner;
			minner = arr[i];
		}
		else if(arr[i] < min)
			min = arr[i];
	}

	return minner;
}

void main()
{
	int arr[] = {4,5,2,3,1,0};
	cout << SecondMinSingleLoop(arr, 6);
}